package com.ruoyi.web.controller.trans.api;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.trans.domain.BaSupplier;
import com.ruoyi.trans.domain.BusTransportationDoc;
import com.ruoyi.trans.service.IBaSupplierService;
import com.ruoyi.trans.service.IBusTransportationDocService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@Api("用户信息管理")
@RestController
@RequestMapping("/api/trans/doc")
public class BusTransportationDocApiController extends BaseController {
    @Autowired
    IBusTransportationDocService busTransportationDocService;

    @PostMapping("add")
    public R<String> add(BusTransportationDoc doc) {

        if (busTransportationDocService.checkDocUni(doc)) {
            return R.fail("该时段预约已满");
        }
        busTransportationDocService.insertBusTransportationDoc(doc);
        return R.ok();
    }

    @PostMapping("edit")
    public R<String> edit(BusTransportationDoc doc) {
        if (busTransportationDocService.checkDocUni(doc)) {
            return R.fail("该时段预约已满");
        }
        busTransportationDocService.updateBusTransportationDoc(doc);
        return R.ok();
    }
}
